package com.huayun.dcsp.configclient.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

@Service
public class TestService {
	 @Autowired
	 RestTemplate restTemplate;
	 
	 @HystrixCommand(fallbackMethod = "addFallback")
	 public String add() {
		 return restTemplate.getForEntity("http://service1/add?a=10&b=20", String.class).getBody();
	 }
	 
	 public String addFallback() {
	     return "error";
	 }

}
